using UnityEngine;
using System.Collections;

public class Escalera : MonoBehaviour
{

    private PlayerControl player = null;           // el player

    public GameObject posicionPlayer = null;        // posicion para que el player pueda subir y bajar 

    // Use this for initialization
    void Start()
    {
        // Buscamos al Player por Tag.
        GameObject playerGO = GameObject.FindGameObjectWithTag(StringConstants.TAG_PLAYER);
        if (playerGO)
            player = playerGO.GetComponent<PlayerControl>();
    }

    void OnTriggerEnter(Collider hit)
    {
        if (hit.gameObject.tag == StringConstants.TAG_PLAYER)
        {
            player.EntraEscalera(posicionPlayer);
            
        }

    }

    void OnTriggerExit(Collider hit)
    {
        if (hit.gameObject.tag == StringConstants.TAG_PLAYER)
        {
            player.SaleEscalera();
        }
    
    }
    
}
